<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<script type="text/javascript">
$('#tt').tabs({
    border:false,
    onSelect:function(title){
		alert(title+' is selected');
    }
});

$(".zhxz_xingzeng").click(function(){
	 $("#zhxz_timu").val("");
	 $("#zhxz_daan").val("");
	 var tk=$("#Tiku").combobox("getValue");
	 var zsz=$("#Zhishizu").combobox("getValue");
	 var nyd=$("#Nanyidu").combobox("getValue");
	 var fs=$("#Fenshu").combobox("getText");
	if(tk==""){
      $("#tkzh_panduan2").show();
	  $("#tkzh_panduan2").text("题库不能为空（勾选/输入）!").fadeOut(3000);
    }else if(zsz==""){
      $("#tkzh_panduan2").show();
   	  $("#tkzh_panduan2").text("知识组不能为空（勾选/输入）!").fadeOut(3000);
   }else if(nyd==""){
   	 $("#tkzh_panduan2").show();
   	 $("#tkzh_panduan2").text("难易度不能为空（勾选/输入）!").fadeOut(3000);
   }else if(fs==""){
   	 $("#tkzh_panduan2").show();
   	 $("#tkzh_panduan2").text("分数不能为空（勾选/输入）!").fadeOut(3000);
   }else{
	 $("#tk_zonghexingzeng").window("open"); 
   }
});

/* $(".zhxz_shitibaocun").click(function(){
	$("#tk_zonghexingzeng").window("close"); 
});
 */
$(function(){
 	$('#zhxz_anpai').datagrid({    
 		//数据源地址
	    columns:[[
	    	{field:'TIMU',fixed:false,width:180,title:'题目',align:'center'}, 
	        {field:'DAAN',fixed:false,width:180,title:'答案',align:'center'},
	        {field:'caozuo',width:260,formatter:operate,title:'操作',align:'center'} 
	    
	    ]],
	    pagination:true,
	    pageNumber:1,
	    pageSize:5,
	    pageList:[5,10,15]        
	});
 	//在每个操作列里面添加编辑，查看，明细，删除
 	function operate(value, row, index) { 	
 	     return "<button class='zhxz_shanchu' onClick='tkzh_shanchu("+index+")'>删除</button>";
 	} 
})
function tkzh_shanchu(indexs){
	$("#zhxz_anpai").datagrid("deleteRow",indexs); 	
}
 
$(function(){
	//提示框隐藏
	$("#tkzh_panduan").hide();
	$("#tkzh_panduan2").hide();
	//显示
	 $('#Tiku').combobox({
		 url:'tiku',
		 valueField:'QSBID',
		 textField:'QSBBANK'
	 });
	
	 $('#Zhishizu').combobox({
		 url:'zhishidian',
		 valueField:'TMZID',
		 textField:'tmzsd'
	 });
	 
	 $('#Nanyidu').combobox({
		 url:'nanyidu',
		 valueField:'TMZID',
		 textField:'tmnyd'
	 });
	 
	 $('#Fenshu').combobox({
		 url:'fenshu',
		 valueField:'TMZID',
		 textField:'TMFS'
	 });
	
	 $(".zhxz_shitibaocun").click(function(){
		 var tm=$("#zhxz_timu").val();
		 var da=$("#zhxz_daan").val();
		 
		 if(tm==""){
			 $("#tkzh_panduan").show();
		     $("#tkzh_panduan").text("题目不能为空!").fadeOut(3000);
			 
		 }else if(da==""){
		    	$("#tkzh_panduan").show();
		    	$("#tkzh_panduan").text("答案不能为空!").fadeOut(3000);
		 }else{
		 
		 var row = {
				 TIMU:$("#zhxz_timu").val(),
				 DAAN:$("#zhxz_daan").val(),
				};
				$('#zhxz_anpai').propertygrid('appendRow',row);
				 $("#tk_zonghexingzeng").window("close");
	 }
		 });
	 
	 $(".zhxz_baocun").click(function(){
		 var tk=$("#Tiku").combobox("getText");
		 var zsz=$("#Zhishizu").combobox("getText");
		 var nyd=$("#Nanyidu").combobox("getText");
		 var fs=$("#Fenshu").combobox("getText");
		 
		 var rows = $("#zhxz_anpai").datagrid("getRows");
		 for(var i=0;i<rows.length;i++){
			 $.ajax({
				 url:"shunzheti",
				 type:"post",
				 data:{
					 //tmid, tk, zsz, nyd, TIMU, fs, type, DAAN
					 tmid:null,
					 tk:tk,
					 zsz:zsz,
					 nyd:nyd,
					 TIMU:rows[i]["TIMU"],
					 fs:fs,
					 type:"综合题",
					 DAAN:rows[i]["DAAN"]
				 },
			     success:function(){
			    	 
			     }

			 }) 
		 }
			 $("#zhxz_timu").val("");
			 $("#zhxz_daan").val("");
		 $("#tk_zonghetankuang").window("open"); 
    	 
	 });
	
	 
	 
});
/* $(".zhxz_baocun").click(function(){
	$("#tk_zonghetankuang").window("open"); 
}); */

$(".zhxz_queding").click(function(){
	$("#tk_zonghetankuang").window("close"); 
	close("新增综合试题");
});

$(".zhxz_qu").click(function(){
	$("#tkzh_quxiao").window("open"); 
});

$(".zhxz_queding").click(function(){
	$("#tkzh_quxiao").window("close"); 
	close("新增综合试题");
});
 </script>
             <div class="tkzh_panduan2" id="tkzh_panduan2" ></div>
			 <div id="tk_zonghexingzeng" class="easyui-window" title="综合题新增" style="width:690px;height:320px"
		    		data-options="closed:true,minimizable:false,maximizable:false,collapsible:false,modal:true">
		    		             <div class="zonghexingzeng_one">
		    		                   <div class="zhxz_timus">题目： <input type="text" id="zhxz_timu"></div>
		    		             </div>
		    		             <div class="zonghexingzeng_two">
		    		                   <div class="zhxz_daan"><span style="color:black;font-family:'微软雅黑';font-size:16px">答案：</span> <textarea cols="60" rows="10" class="zhxz_da" type="text" id="zhxz_daan"></textarea></div>
		    		             </div>
		    		      
		    		             <div class="zonghexingzeng_three">
		    		                  <button class="zhxz_shitibaocun"><img src="../static/tyl/images/go.png">保存</button>
		    		             </div>
		    		             
		    		              <div class="tkzh_panduan" id="tkzh_panduan" ></div>
		    		</div>
		    		<div id="tk_zonghetankuang" class="easyui-window" title="新增" style="width:320px;height:165px"
		    		data-options="closed:true,minimizable:false,maximizable:false,collapsible:false,modal:true">
		    		             <div class="zonghetankuang_one">
		    		                   <div class="zhxz_chenggong">新增成功！</div>
		    		                  
		    		             </div>
		    		             <div class="zonghetankuang_two">
		    		                  <button class="zhxz_queding">确定</button>
		    		             </div>
		    		</div>
		    		<div id="tkzh_quxiao" class="easyui-window" title="新增" style="width:320px;height:165px"
		    		data-options="closed:true,minimizable:false,maximizable:false,collapsible:false,modal:true">
		    		             <div class="zonghetankuang_one">
		    		                   <div class="zhxz_chenggong">确定取消新增综合题？</div>
		    		                  
		    		             </div>
		    		             <div class="zonghetankuang_two">
		    		                  <button class="zhxz_queding">确定</button>
		    		             </div>
		    		</div>
       <div class="zonghexingzeng_zong">
             <div class="zonghexingzeng_top">
                  <div class="zhxz_one">
                        <div class="zhxz_tiku">
                             <div class="zhxz_tikuone">
                                <img src="../static/tyl/images/tiku.png">
                             </div>
                             <div class="zhxz_tikutwo">题库：
                               <input id="Tiku" class="easyui-combobox tikeshuru">
		    		          </div>
		    		     </div>
		    		
                       <div class="zhxz_zhishizu">
                             <div class="zhxz_zhishizuone">
                                <img src="../static/tyl/images/zhishi.png">
                             </div>
                             <div class="zhxz_zhishizutwo">知识组
                              <input id="Zhishizu" class="easyui-combobox zhishizushuru">
		    		          </div>
		    		    </div>
		    		</div>
                  <div class="zhxz_two">
                       <div class="zhxz_nanyidu">
                              <div class="zhxz_nanyiduone">
                                <img src="../static/tyl/images/nanyidu.png">
                             </div>
                             <div class="zhxz_nanyidutwo">难易度
                                 <input id="Nanyidu" class="easyui-combobox nanyidushuru">
                    
		    		          </div>
		    		     </div>
                       <div class="zhxz_fenzhi">
                             <div class="zhxz_fenzhione">
                                <img src="../static/tyl/images/fenzhi.png">
                             </div>
                             <div class="zhxz_fenzhitwo">分值：
                                 <input id="Fenshu" class="easyui-combobox fenshushuru">
                             
		    		          </div>
		    		        </div>
		    		        
                   </div>
                  <div class="zhxz_three">
                       <div class="zhxz_shunxiangshu">
                             <div class="zhxz_shunxiangshuone">
                                <img src="../static/tyl/images/shunxiang.png">
                             </div>
                              <div class="zhxz_shunxiangshutwo">题目：
                                  <button class="zhxz_xingzeng">新增</button>
		    		          </div>
		    		    </div>
		    		     </div>
		    	</div>
		 
		  
             <div class="zonghexingzeng_bottom">
                      <table id="zhxz_anpai" class="easyui-datagrid" style="width:100%;height:280px;margin-top:20px;" data-options="fitColumns:true">
                                 
                      </table>
                        <div class="zhxz_anniu">
                            <div class="zhxz_baocun"><button class="zhxz_bao"><img src="../static/tyl/images/go.png">保存</button></div>
                            <div class="zhxz_quxiao"><button id="dsxz-save" class="zhxz_qu"><img src="../static/tyl/images/cha.png">取消</button> </div>
                       </div>    
             </div> 
		  </div>
</body>
</html>